$(document).ready(function(){
    // file_detail.html
    $('.file-detail-display-image').click(function(){
        var img = $('<img/>');
        img.attr('src', '/static/spinning-circle.gif');
        img.attr('alt', '');
        $('#file-detail-display-image-placeholder').html(img);

        $.get("/file/base64/" + this.id, {}, function(data) {
            var img = $('<img/>');
            img.attr('src', data);
            img.attr('alt', '');
            $('#file-detail-display-image-placeholder').html(img);
        });
    });
    
    
    // host_explorer.html
    $("#explorer .tags .insert").click(function(){ 
        var file_id = $(this).attr("file_id");
        var tag = $("#tag-value-" + file_id).attr("value");
        if (tag != "") {
            $.post("/tag/add", {id: file_id, tag: tag});
        }
    });
    
    // search.html
    $("#search-results .contents .line").hide();
});